

size <- as.data.frame(fread(here('results','tables',"homophily_all.csv")))
pdf(here('results','figures',"homophily.pdf"),paper="special",width=5,height=4)
size1 <- size 
x <- size1$Year 
x[x==2016] <- c(2015.5,2016.5)

y <- size1$mean 
lci <- size1$"lower CI"
uci <- size1$"upper CI"

col <- ifelse(size1$name=="pol","red","blue")
pch <- ifelse(size1$name=="pol",1,19)

plot(x,y,ylim=c(0.5,0.85),xlim=c(1985,2017),col=col,pch=pch,xaxt="n",xlab="",
	ylab="% of same party ID or voting within networks")
axis(1,at=size1$Year[size1$Year!=2017],labels=as.character(size1$Year[size1$Year!=2017]),cex.axis=0.8,las=2)
for (i in 1:length(x)) lines(c(x[i],x[i]),c(lci[i],uci[i]),col=col[i])
legend("topleft",c("important matters","political matters"),col=c("blue","red"),lty=1,bty="n",pch=c(19,1),cex=0.8)

dev.off()
